from django import forms
from collectionsapp.models import Collection

class CollectionForm(forms.Form):
    name = forms.CharField(max_length=100, label="Nome")
    description = forms.CharField(required=False, label="Descricao", widget=forms.Textarea)     
    cover = forms.CharField(max_length=100, label="Capa", required=False)
    
    def save(self, request):
        cd = self.cleaned_data
            
        new_collection = Collection(name = cd["name"],
                cover = cd["cover"],
                description = cd["description"])                                        
        new_collection.save()
                
        return new_collection